/*
 * #%L
 * Osm2garminAPI
 * %%
 * Copyright (C) 2011 Frantisek Mantlik <frantisek at mantlik.cz>
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 2 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/gpl-2.0.html>.
 * #L%
 */
package be.dch.srtm2osm.domain;

/**
 * 
 * @author fm
 */
public class Point {

    private double x;
    private double y;

    public Point() {
	super();
    }

    public Point(final double x, final double y) {
	super();
	this.x = x;
	this.y = y;
    }

    public double getX() {
	return this.x;
    }

    public void setX(final double x) {
	this.x = x;
    }

    public double getY() {
	return this.y;
    }

    public void setY(final double y) {
	this.y = y;
    }

    @Override
    public boolean equals(final Object p) {
	boolean result;
	if (p.getClass().isAssignableFrom(Point.class)) {
	    final Point pp = (Point) p;
	    result = ((this.x == pp.getX()) && (this.y == pp.getY()));
	} else {
	    result = this.equals(p);
	}
	return result;
    }

    @Override
    public int hashCode() {
	int hash = 3;
	hash = (17 * hash) + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32));
	hash = (17 * hash) + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32));
	return hash;
    }

    @Override
    public String toString() {
	return "[" + this.getX() + "," + this.getY() + "]";
    }
}
